AC_INIT([guile-semver], [0.1.0], [jlicht@fsfe.org])

AC_CONFIG_AUX_DIR([build-aux])
PKG_CHECK_MODULES([GUILE], [guile-2.2])

AM_INIT_AUTOMAKE([color-tests -Wall -Werror foreign])

m4_ifdef([GUILE_PROGS],
         [],
         [AC_ERROR(could not locate guile aclocal macros)])

GUILE_PKG([2.2 2.0])
GUILE_PROGS

AC_PATH_PROG([GENHTML], [genhtml])
AM_CONDITIONAL([HAVE_GENHTML], [test -n $GENHTML])

AC_CONFIG_FILES([Makefile semver/package-config.scm])
AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
AC_CONFIG_FILES([tools/coverage], [chmod +x tools/coverage])

dnl Prepare a version of $datadir that does not contain references to
dnl shell variables.  (Borrowed from Sly, which borrowed from Guix...)
guile_semver_prefix="`eval echo $prefix | sed -e"s|NONE|/usr/local|g"`"
guile_semver_datadir="`eval eval echo $datadir | sed -e "s|NONE|$guile_semver_prefix|g"`"
AC_SUBST([guile_semver_datadir])

AC_OUTPUT
